<%@page import="wrapper.CartMovie"  %>
<%@page import="wrapper.MovieIssue"  %>
<%@page import="java.util.*"  %>
<%@page import="java.text.*"  %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ include file="/title.html" %>
</head>
<body>
<table width="100%">
<%@ include file="/header.jsp" %>

<tr valign="top"><td align="center" height="300px">
<table width="100%">

<tr valign="top" height="50px">
<td align="center">
<%@ include file="/headerLinks.jsp" %>
</td>
</tr>
<tr><td align="center" height="40px" colspan="2" valign="top"><h3>Bill</h3></td></tr>
<% if(request.getAttribute("message") != null) { %>
<tr><td align="center" style="color:red"><%= request.getAttribute("message") %></td></tr>
<% } %>

<%if(null != session.getAttribute("CartMovie")) { 
%>  
<tr>
    <td align="center">
    <table  width="90%" style="text-align:left">
         <tr>
            <td width="5%">No.</td>
            <td width="10%">Movie Name</td>
            <td width="15%">Banner</td>
            <td width="8%">Category</td>
            <td width="15%">Due Date</td>
            <td width="12%">Rent Amount</td>            
            <td width="15%">Price for You</td>           
        </tr>
<%  
    MovieIssue[] aMovieIssue = (MovieIssue[]) request.getAttribute("MovieIssue");
    String memType = (String) session.getAttribute("MemberType");
    int cartItemId = 0, itemId=0, quantityInCart = 0;
    int i,j;
    float total = 0;
    for(i=0;i<aMovieIssue.length;i++) {
        String availability = "Out Of Stock";
        boolean available = false;
        float yourPrice;
        
        if(memType.equals("SC"))
        yourPrice =  aMovieIssue[i].getRentamount();
        else
            yourPrice = 0.0f;
        
        total += yourPrice;
        Calendar c= aMovieIssue[i].getDuedate();
    	java.util.Date d=new java.util.Date(c.getTimeInMillis());
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    	String dueDate = sdf.format(d);
%>
    
        <tr style="text-align:left">
            <td><%=i+1%></td>
            <td><%=aMovieIssue[i].getMoviename() %></td>
            <td><%=aMovieIssue[i].getMoviebanner() %></td>
            <td><%=aMovieIssue[i].getCategory() %></td>
            <td><%=dueDate %></td>
            <td><%=aMovieIssue[i].getRentamount()%></td>
           
            <td>
                <%=yourPrice%>      
            
            </td>
            
            
            
            
        </tr>
         
<%  } %>
    <tr>
        <td colspan="6"></td>       
    </tr>
    
    <tr>
        <td colspan="6"><hr></td>       
    </tr>
    <tr>
        <td colspan="5"></td>
        <td align="left">Total</td>
        <td align="left"><%=total%></td>
    </tr>
    
    
    
    </table>
    </td>
</tr>
<%} %>

</table>
</td>
</tr>

<%@ include file="/bottom.html" %>
</table>
</body>
</html>